GH+Python Practice #02 | Text Processing
Contents
- Functions
- Import
- Export
- Practice
- Lists in List to Text
- DataTree to Text
Functions
- <text>[<n>] – find<n>th character in <text>
- len(<text>) – find the length of <text>
- <text to split>.split(<separator>) – split <text to split> with <separator>
- <separator>.join(<list of texts>) – join <list of texts> with <separator>
- <text to search>.find(<character>) – find <character> from <text to search> It returns index of character, if it’s not found, it returns “-1”
- <text to check>.startswith(<prefix>) – check if <text to check> starts with <prefix>
- <text>.(<char to replace>,<replacer>) – replace <char to replace> in <text> with <replacer>
Import
Use “Read File” component to import text files.
Export
Use “Panel” component to export text files. Right click “Panel” and select “Stream Contents”, then define file directory and name to save.