!zmyrnKFHlKUrOGgOxi:matrix.org

Gavin's General Overflow

226 Members
12 Servers

Load older messages


SenderMessageTime
29 Jun 2022
@trueauracoral:tchncs.detrueauracoralyeah I have used functions16:22:55
@trueauracoral:tchncs.detrueauracoralI think last time I used a function was 3 days ago16:23:02
@trueauracoral:tchncs.detrueauracorallike I wrote it myself16:23:08
@trueauracoral:tchncs.detrueauracoralhere it is16:23:09
@trueauracoral:tchncs.detrueauracoral
    def extract_zips(file_name, url):
        print("Downloading Zip file...")
        with open(file_name,"wb") as f:
            f.write(requests.get(url).content)
        print("Extracting Zip file...")
        with ZipFile(file_name,"r") as zip:
            zip.extractall()
        print("Finished Extraction...")
        os.remove(file_name)
        print("Removed zip file")
16:23:34
@_discord_679283565996933142:t2bot.ioRaph#1818 good 16:25:05
@_discord_679283565996933142:t2bot.ioRaph#1818 hipe you're writing ur programs as a bunch of functions 16:25:14
@_discord_679283565996933142:t2bot.ioRaph#1818 * hope you're writing ur programs as a bunch of functions 16:25:21
@trueauracoral:tchncs.detrueauracoralyeah16:25:27
@_discord_679283565996933142:t2bot.ioRaph#1818 if you're not writing a basic script a good idea if having a main function 16:25:35
@trueauracoral:tchncs.detrueauracoralyeah that's why it's right now hard to touch my biggest program pokeflix.py16:26:08
@trueauracoral:tchncs.detrueauracoralit's all messy16:26:09
@trueauracoral:tchncs.detrueauracoralno functions16:26:12
@_discord_679283565996933142:t2bot.ioRaph#1818 like this
def main():
  pass

if __name__ == '__main__':
  main()
16:26:10
@trueauracoral:tchncs.detrueauracoralhow does that help? your anyways going to be writing code and it will run without the main function16:26:37
@trueauracoral:tchncs.detrueauracoralDownload Luke.webm16:26:41
@trueauracoral:tchncs.detrueauracoralyou jus tnow have another indent16:26:41
@_discord_679283565996933142:t2bot.ioRaph#1818 this prevents code from running if you import main, it's standard practice

name takes the name of the module that's executing
16:27:56
@_discord_679283565996933142:t2bot.ioRaph#1818 also every compiled language has a main function 16:28:18
@_discord_679283565996933142:t2bot.ioRaph#1818 so this is how it's done in most "serious" languages 16:28:30
@_discord_679283565996933142:t2bot.ioRaph#1818 it's basically what the operating system will look for when u start a program 16:28:53
@_discord_679283565996933142:t2bot.ioRaph#1818 * this prevents code from running if you import main, it's standard practice

__name__ takes the name of the module that's executing
16:29:55
@trueauracoral:tchncs.detrueauracoraloh interesting16:47:58
1 Jul 2022
@ntroxxxx:matrix.org@ntroxxxx:matrix.org left the room.01:00:53
@alloca123:matrix.alloca.devArmando Pérez changed their display name from alloca to Armando Pérez.22:58:13
2 Jul 2022
@_discord_392477277558013954:t2bot.ioArcadius#6969 changed their display name from Techjunkie#6969 to Arcadius#6969.09:57:24
3 Jul 2022
@_discord_515313851693137921:t2bot.ioGalacticColourisation#5721 changed their profile picture.17:37:32
5 Jul 2022
@_discord_358960666238910465:t2bot.ioSpeykious#7435 changed their display name from Speykious to Speykious#7435.14:03:34
7 Jul 2022
@_discord_285304593837981696:t2bot.ioViChyavIn joined the room.00:07:25
@dr-counelis:matrix.orgdem changed their profile picture.09:28:47

There are no newer messages yet.


Back to Room List