Python 速成指南 2

75 阅读1分钟

一些基础

更多内容在仓库看起来更方便~

hello.py

message = 'hello world!'  
print(message)
f.py

var1 = 'ppx'
var2 = 'CC'
print(f'{var1}-{var2}')
# ppx-CC
list.py
items = ['ppx', 'fish', 'meal']
print(items)
# ['ppx', 'fish', 'meal']
print(items[0])
# ppx
print(items[0].title())
# Ppx
print(f'I like to eat {items[0]} and {items[1]}')
# I like to eat ppx and fish
philosophy.py

# Simple is better than complex.  
# Complex is better than complicated.  
# Readability counts.  
# There should be one-- and preferably only one --obvious way to do it.  
# Now is better than never.

仓库

github.com/huanhunmao/…