Write text file with given content at specified Path

Please use the script to write given content on specified text file

## Pass the path here, for example "C:\samplefile.txt"
path = 'C:\samplefile.txt'
## Pass your content here to write there on the file
contents = """
Sample Content 1
Sample Content 2
Sample Content 3
Sample Content 4
Sample Content 5
    with open(path, 'w') as fiOb:
        print 'Success: File has been written at - '+path
    print 'Fail: Check your path!!'

Sample Output:

Write File with Given texts and Path (Including text file name).PNG