python基礎①

夜神moon發表於2018-01-07

改變工作環境

import os
os.chdir("I:\pythonwork")
os.getcwd()
`I:\pythonwork`

for迴圈

cities = ["beijing","shanghai","guangzhou"]
for city in cities:
    print(city)

if語句

animals = ["cat","mouse","rabbit"]

if "cat" in animals:
    print("yes")
else:
    print("no")