0

i just finished learning python so i try to build my first project which is backup tool but from many dir so the problem as always with me in windows path and backslash here is the code

import os
def list():
    AO = True
    while AO:
        list_files = []
        user_input = input("please put path of the file : ")
        list_files.append(user_input)

so when i try to print the list i get path with double backslash so is there any way to get input as raw string

  • Please, fix typo's and use a code block.. – brunsgaard Jun 25 '16 at 12:56
  • 2
    Don't worry about the doubled backslashes, that's just the string representation, which is what you see when you print a list of strings. The paths will be correct. However, you have a logic error: you need to put `list_files = []` _before_ the start of the `while` loop. – PM 2Ring Jun 25 '16 at 12:57
  • not duplicate as i saw this before but it works when you give it as var without user input – Abdelrhman Salah Jun 25 '16 at 14:47
  • yes i know i have to put list_files out the while loop or it will enter the loop with it and have new list every time thanks i hope it works – Abdelrhman Salah Jun 25 '16 at 14:48

0 Answers0