Saving “ Marks To File Using TextView
James007 last edited by ccc
TextView - Saving TextView text to a file. Cannot save when text contains a “ quotation mark. All other normal characters can be saved.
def SAVE_SCOPEB(sender): jf.open(“Note_Data.py”, ‘w’) jf.write(JWriteNote.text) jf.close()
The above function works and saves text to a disk file on cloud, but when a quotation mark is part of the text, the following message is received - ‘ascii’ codec, can’t encode, characters in positions 0-1: ordina....
My first post, Thank you in advance.d
cvp last edited by
@James007 this works(see 'wt')
import ui v = ui.View() v.frame = (0,0,400,400) JWriteNote = ui.TextField(name ='JWriteNote') JWriteNote.frame = (10,10,200,32) v.add_subview(JWriteNote) b = ui.ButtonItem() b.title = 'save' def SAVE_SCOPEB(sender): with open('Note_Data.py', 'wt') as jf: jf.write(JWriteNote.text) b.action = SAVE_SCOPEB v.right_button_items = (b,) v.present('sheet')
Jim007 last edited by
Thanks CVP, I will give it a try ....