python日常__python

來源:互聯網
上載者:User
# -*-coding:utf-8-*-""" 如果注釋裡面需要中文  需要加上上面的代碼"""age = input('you think you input number ?')age10 = int(age) + 10print 'you age is ' + str(age10) """ 這裡需要注意  輸出的時候 需要將age10轉換為str  """ages = 3 * '5'print type(ages)"""<type 'str'>"""jack1 = 3 * 5.0print type(jack1)"""<type 'str'>"""print ('jack', 'hello', 'world')print ('jack', 'java')# 這是一個行注釋  """ 這是一個行列注釋"""print False == Falseprint False and Falseprint not True# this is if number = input('you input win number ')if number == 10:                               print 'yes 'elif number == 20:    print 'no'# this  is if two hopeyou = raw_input("you name ")if hopeyou == 'jack':    print'yes 'elif hopeyou == 'pcc':    print 'you name is' + hopeyouelif hopeyou == 'kt':    print " yes"else:    print 'hack'# this is if  elifpwd = input('what is the passwordl ?')if pwd == 'apple':    print 'win'elif pwd == 'a':    print'root'else:    print 'out '

問題說明:根據作者使用 好像在使用 raw_input的時候在控制台進行輸入的時候,當輸入String or char的時候不要加引號.但是如果使用是input的話,必須使用引號

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.