0

I'm working in a wordcloud and I was thinking in a way to open whatever file as an input chosen by the user. For example, an docx file like input and exctrat all text on it and do the wordcloud. Or use a csv file or txt file, something like that.

I've tried with some libraries like pandas, but por each type of document I spent some lines of code and 'if loops' to test the type of the file.

Maybe:


But I'm not very sure about that.

3
  • Maybe: open('file', r): Commented Jul 18, 2019 at 21:06
  • But word documents are binary... Commented Jul 18, 2019 at 21:12
  • You'll really have be more specific, especially about what you've tried. SO is not a free design and coding site. Commented Jul 18, 2019 at 21:14

1 Answer 1

1

I think you should use different libraries for every extension, because you can't simply skip the headers and then read the content. At least not using just some variant of "with a as open("path")"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.