














import os
if expression :
statement1
else :
statement2
os.name
os.system()
helloworld.py:
'''
Created on Dec 11, 2018
@author: xiaobin
'''
import os
'''
#! /usr/bin/perl
$cmd="ls";
system($cmd);
##chmod
$myStr2 = 'world';
print 'Hello $myStr2'."\n"
'''
cmd = "name"
if os.name == "nt" :
cmd = "dir /w"
else :
cmd = "ls -l"
print ('----'),
print (cmd),
print ('----')
os.system(cmd)
myStr2 = 'world'
print('Hello ' + myStr2)
python.exe helloworld.py


1. Python 条件语句
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。