Point a favor and leave a note !!
Catalog
One 、 Get computer user name
Two 、 String case
3、 ... and 、 Operation conditions (|,&==or,and)
Four 、 Determine whether to connect to the Internet
5、 ... and 、 Open the specified web address using the default browser
import getpass # The import module
user_name = getpass.getuser()
print(user_name) # Print user name
a= 'abcdeFGHIJK'
print(a.lower()) # Change to lowercase abcdefjhijk
print(a.upper()) # Capitalize ABCDEFGHIJK
# | == or As long as one condition is satisfied, it is True
# & == and If all conditions must be met, it is True
# '''| or'''
q = input(' Excuse me, are you Grandpa 、 grandma 、 Father or mother :')
if (q == ' grandpa ') | (q == ' Dad '): # As long as one condition is met True Then carry out
print(' You are a male ')
else:
print(' You are a woman ')
e = input(' Excuse me, are you Grandpa 、 grandma 、 Father or mother :')
if (e == ' grandpa ') or (e == ' Dad '): # As long as one condition is met True Then carry out
print(' You are a male ')
else:
print(' You are a woman ')
# '''& and'''
r = input(' How many points did you get in the exam ( Full marks 100):')
if (r > '60') & (r < '80'): # All conditions must be met True Will execute
print(' pass ')
t = input(' How many points did you get in the exam ( Full marks 100):')
if (t > '60') and (t < '80'): # All conditions must be met True Will execute
print(' pass ')
import pywifi
from pywifi import const
wifi = pywifi.PyWiFi() # Grab the network card interface
iface = wifi.interfaces()[0] # Access to network card
if iface.status() == const.IFACE_CONNECTED:
print(' Connected to the network ')
else:
print(' Network error !!!')
import webbrowser
webbrowser.open('www.baidu.com')