Skip to content

Instantly share code, notes, and snippets.

@mezcel
Last active May 11, 2020 12:14
Show Gist options
  • Select an option

  • Save mezcel/fa9f298a0e02ff8f7afa02b05f2804f8 to your computer and use it in GitHub Desktop.

Select an option

Save mezcel/fa9f298a0e02ff8f7afa02b05f2804f8 to your computer and use it in GitHub Desktop.
python notes
## win10 line endins
*.bat eol=crlf
*.ps1 eol=crlf
## Linux/Posix line endins
*.sh eol=lf
Makefile eol=lf

code-examples

while loop

count = 0
while ( count < 3 ):
    count = count + 1
    print(count)
else:
    print("other than count is less than 3")

for loop

n = 3
for i in range(0, n+1):
    print(i)

arr=["hello", "world", "hello world"]
for i in arr:
    print(i)

use python to navigate the file system

import os
import subprocess

currdir = os.getcwd()
print(currdir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment