On the Python using r front of the file path, can deal with escape sequence such as :
df = pd.read_csv(r"D:\datasets\42133.csv")
However on Julia, the below code returns, MethodError: no method matching joinpath(::Regex)
file_path = r"D:\datasets\42133.csv"
df = DataFrame(CSV.File(file_path))
I checked this, and know that I can chage \
to \\
or /
. But wondering that why Julia does not allowed to use r"String"
? Also is there something like r"String"
on Julia?
All escape sequences in Julia start with '\'. \" is an escape sequence that is used to double-quote inside the formatted version of a string. \n is an escape sequence that is used to shift the bits of string onto the next line. \t is an escape sequence that is used to insert space up to the next tab stop.
The cmp() is an inbuilt function in julia which is used to return 0 if the both specified strings are having the same length and the character at each index is the same in both strings, return -1 if a is a prefix of b, or if a comes before b in alphabetical order and return 1 if b is a prefix of a, or if b comes before ...
You are looking for raw"..."
string.
julia> raw"D:\datasets\42133.csv"
"D:\\datasets\\42133.csv"
In Julia, r"..."
strings create a Regex object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With