Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
devwiki:python [2022/04/17 05:24] – [data operation] ying | devwiki:python [2022/06/26 14:10] – [string operation] ying | ||
---|---|---|---|
Line 424: | Line 424: | ||
* text block to clean row list <code python> | * text block to clean row list <code python> | ||
data_list = [row.strip() for row in source_txt.split(' | data_list = [row.strip() for row in source_txt.split(' | ||
+ | </ | ||
+ | |||
+ | * to use non-ascii character in python file, you need to put encoding in first line of code, or you will get " | ||
+ | # coding: utf-8 | ||
+ | my_special_string = u" | ||
</ | </ | ||
Line 1135: | Line 1140: | ||
subprocess.Popen([r' | subprocess.Popen([r' | ||
</ | </ | ||
+ | * subprocess a console app and get return, and optionally hide the pop up console when call <code python> | ||
+ | # hide popup console for win platform only | ||
+ | startupinfo = subprocess.STARTUPINFO() | ||
+ | startupinfo.dwFlags |= 1 # | ||
+ | # startupinfo.wShowWindow = subprocess.SW_HIDE #(optional) | ||
+ | info=subprocess.Popen( ' | ||
+ | out, err = info.communicate() | ||
+ | </ | ||
==== string related ==== | ==== string related ==== | ||