第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
    • 只要重寫了 __str__()方法,不管是打印對象還是打印對象的字符串格式,其調(diào)用的都是 __str__()方法,所以顯示的都是重寫的__str__()結(jié)果。也就是說,print(str(obj)) 和 print(obj) 是一樣的。

    • 而只有在控制臺(window下的cmd,命令提示符)中,在python環(huán)境下直接輸入(不是打印)obj,回車,調(diào)用的才是 __repr__()方法。如果沒有重寫該方法,還是會顯示對象所在的地址。

    查看全部
  • __count是類屬性,如果將print(dog.__count)放到cat對象建立后面,將打印出2.因為cat對象建立后,Animal的屬性__count就變了,dog能訪問__count屬性,所以就變了。

    查看全部
  • # Enter a code

    from functools import reduce

    result =? [item for item in map(lambda x:x*x,[1,2,3,4,5,6])]

    print (result)


    print reduce(lambda x,y:x+y,[1,3,5,7,9])

    print sorted(['bob','MD','22A','QQ','mm'],key=lambda item:item.lower(),reverse = True)

    查看全部
  • # Enter a code

    L=[2,4,1,45,12,33,11,44,21]

    K=['aad','']

    print sorted(L)

    def k(item):

    ? ? return item.lower()

    print sorted(['Bod','UUU1PPP','qqasd'],key=k ,reverse=True)

    查看全部
  • 2我為1wee

    查看全部
  • # Enter a code

    import math

    def is_odd(x):

    ? ? return x%2 ==1

    ? ??


    for item in filter(is_odd,[1,6,9,54,52,2,4,8,7]):

    ? ? print(item)

    def? is_empty(s):

    ? ? ?return s? ?and len(s.strip())>0

    L =['te? st',None,'? str','','? ','END']? ??

    for item1 in filter (is_empty,L):

    ? ? print(item1)

    def sqr(x):

    ? ? r = int(math.sqrt(x))

    ? ? return r*r == x

    for item2 in filter(sqr,(range(1,101))):

    ? ? print item2

    查看全部
  • from functools import reduce


    def f(x,y):

    ? ? return x*y

    print(reduce(f,[1,3,5,7,9,12,4,5,100,7894,7896321,789456123]))

    查看全部
  • # Enter a code

    import math

    def? add(x,y,f):

    ? ? return f(x)+f(y)

    print(add(81,64,math.sqrt))

    查看全部
  • python -m http.server 9999 -d C:/

    查看全部
  • lass op(object):
    ? ?def ok(num):
    ? ? ? ?f = open('ok1.txt',mode='a') #讀取中文
    ? ? ? ?f.writelines('\n'+num)
    ? ? ? ?f.close()
    ? ? ? ?e = open('ok81.txt',mode='a+')
    ? ? ? ?e.writelines(num+'\n')
    ? ? ? ?e.close();
    ? ? ? ?gl = open('ok81.txt',mode='r')

    ? ? ? ?content = gl.readlines()
    ? ? ? ?print(content)
    ? ? ? ?gl.close()

    查看全部

  • class op(object):
    ? ?def ok(num):
    ? ? ? ?f = open('ok1.txt',mode='w') #讀取中文
    ? ? ? ?f.writelines(num)
    ? ? ? ?f.close()

    查看全部
  • import os


    class op(object):
    ? ?def ok(num):
    ? ? ? ?f = open('ok1.txt', ?encoding='utf-8') #讀取中文

    ? ? ? ?s = f.read(num)
    ? ? ? ?l= f.readlines()
    ? ? ? ?print(s)
    ? ? ? ?print(l)

    ? ? ? ?f.close()

    查看全部
  • 線下已實現(xiàn)

    #opfile.py

    import os
    class op(object):
    ? ?def ok():
    ? ? ? f = open('ok81.txt', 'x')
    ? ? ? print ('ok92')
    ? ? ? f.close()

    #main.py


    import opfile

    # This is a sample Python script.

    # Press Shift+F10 to execute it or replace it with your code.
    # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.





    def print_hi(name):
    ? ?# Use a breakpoint in the code line below to debug your script.
    ? ?print(f'Hi, {name}') ?# Press Ctrl+F8 to toggle the breakpoint.


    # Press the green button in the gutter to run the script.
    if __name__ == '__main__':
    ? ?print_hi('PyCharm')

    # See PyCharm help at https://www.jetbrains.com/help/pycharm/
    num = input('pls input the num:'+'\n')
    print('this is num is:{}'.format(num))
    opfile.op.ok();

    查看全部
  • class person(object):

    ? ? def __init__(self,name,gender):

    ? ? ? ? self.name = name

    ? ? ? ? self.gender = gender

    ? ? def __call__(self,friend):

    ? ? ? ? print('my name is {}...'.format(self.name))

    ? ? ? ? print('my friend is {}...'.format(friend))

    p= person('alice','female')


    p('box')

    查看全部
  • 看不懂

    查看全部
  • dog.name='xiaocui'
    dog.age=7
    cat.name='cuicui'
    cat.age=8

    print(dog.name)=xiaocui
    print(dog.age)=7
    print(cat.name)=cuicui
    print(cat.age)=8
    查看全部

舉報

0/150
提交
取消
課程須知
本課程是Python入門的后續(xù)課程 1、掌握Python編程的基礎(chǔ)知識 2、掌握Python函數(shù)的編寫 3、對面向?qū)ο缶幊逃兴私飧?/dd>
老師告訴你能學(xué)到什么?
1、什么是函數(shù)式編程 2、Python的函數(shù)式編程特點(diǎn) 3、Python的模塊 4、Python面向?qū)ο缶幊?5、Python強(qiáng)大的定制類

微信掃碼,參與3人拼團(tuán)

微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對慕課網(wǎng)的支持!