Advanced Python - Python projects for Beginners Part 2

14. Open any desktop application using python:

import subprocess
subprocess.Popen('C:\\Windows\\system32\\mspaint.exe')
15. Shutdown PC using python:

import os 

os.system("system  /s  /t 1")
16. Internet speed test using python:


import speedtest library using this command

# pip install speedtest-cli

>>>import speedtest

>>>test = speedtest.Speedtest()
>>>download = test.download()
>>>upload = test.upload()
>>>printf(f"Download speed : {download}\n, upload speed: {upload}")

Output:
Download speed : 11615090.31675668
, upload speed : 889089.0043741286



17. Get service provider using python
import phonenumbers
from phonenumbers import carrier
In [ ]:
mobile = input("Enter mobile number with Country code")
serviceproviders = phonenumbers.parse(mobile)
print(carrier.name_for_number(serviceproviders,"en"))
18. Beep Sound using python
import winsound
In [5]:
frequency = 2500
duration = 5000 #1000ms = 1sec
winsound.Beep(frequency,duration)



19. Create amazing maps in python

Folium is a powerful python library that helps you to create several types of Leafleat maps.


For Displaying map

>>>import folium as fo

>>>map = fo.map
>>>map


Adding Child:
x= fo.FeatureGroup(name='My Map')

x.add_child(fo.Marker(location=[27.1750,78.0422], popup="hello", icon=fo.Icon(color='black')))


map.add_child(x)




20. Extract numbers from a text file:

text file:  Download

   import re
   filename  = input("Enter file name")
   file = open(filename)

   for line in file:
           f = re.findall("[0-9]+",line)
           for num in f:
                    print(num)

Output:
     Enter file name: regex_sum_809799.txt
7225
1989
3092
8530
6225
3542
6839
5807
1308
768
2944
4216
8590
7135
8992
1122
8095
3400
8688
2612
4525
3059
11
9054
1579
3623
1752
2453
6260
9098
7053
4678
5106
8663
3772
7393
2574
3011
4081
8520
4
3254
438
2939
9898
6611
6013
4114
859
2839
9925
2694
1392
2583
9991
3067
6638
8302
5312
3379
1930
6481
7524
9949
360
366
1709
3797
2491
749
9158
1999
6188
2104
6764
8553
2483
9424
6545
5942
4
3
42 

 


Python Projects for beginners Part 1


Comments