Created
September 20, 2013 08:13
-
-
Save jorisroovers/6634623 to your computer and use it in GitHub Desktop.
Python Basics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = open('myfile','w') | |
f.write('hi there\n') # python will convert \n to os.linesep | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filename = raw_input() | |
filename = raw_input("Please enter filename") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
regex = re.compile("(([0-9a-f]*-?)+)/pid$") | |
m = regex.search(pidfile) | |
if m: | |
m.group(0) # complete match | |
m.group(1) # first group in parentheses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment