pythonѧϰ
1.输入输出 输出: print(‘‘),print(‘xixi‘,‘haha‘) 会依次打印每个字符串,遇到逗号“,”会输出一个空格 print(100+200) 输入:input()函数 举例:name=input() >>>name ‘xxx‘ print("请输入您的名字!") name=input() print(‘hello‘,name) 2.数据类型 整型,浮点型, 字符串: print ( " I‘m OK " ) 含有"的字符串,转义字符 print ( ‘ I\‘m \"OK\" ‘ ) 转义字符 \ 可以转义很多字符,比如 \n 表示换行, \t 表示制表符,字符 \ 本身也要转义,所以 \\ 表示的字符就是 \ print(‘hello boys\n girls‘) hello boys girls print(‘hello\they‘) print(‘\\hey\\‘) \hey\ >>> print(‘\\\t\\‘) \ >>> print(r‘\\\t\\‘) \\\t\ 如果字符串内部有很多换行,用 \n 写在一行里不好阅读,为了简化,Python允许用 ‘‘‘...‘‘‘ 的格式表示多行内容 >>> print(‘‘‘line1 ... line2 ... line3‘‘‘) line1 line2 line3 >>> print (r ‘‘