07 Create a Graph - Search And Replace

Warning : there were some mistakes in the code in the video. The code below is correct.

 

text Node script:
plugs.textOut = plugs.textIn

 

Search and Replace node script :

 

fimport os

from kurtis import logInfo

 

files = []

 

for word in plugs.replace:

     file_folder = 'c:/text/'

 

 if not os.path.exists(file_folder):

           os.makedirs(file_folder)

      file = open(file_folder + word + '.txt', 'w')

      file.write(plugs.textIn.replace(plugs.toReplace, word))

      file.close()

      files.append(file.name)

 

logInfo (files)

plugs.files = files