-3

So, I have function ABC in a certain .py file that returns a list. And in ANOTHER .py FILE, i have another function where I'm supposed to write into an empty file (that function will return that new file). I want to write into that new empty file my list gotten with the function ABC. How am I supposed to do that?

Obs - sorry for not posting any code but I really have no ideas about how to do this, besides that I've found nothing in another questions similars to this.

Slifez
  • 53
  • 5
  • This is to vague a question. You need to ask how to pass a list between python functions, then how to write a file out in python. Both of that are available as questions that you can look up. Writing a file can be as a pickle or a text file or other formats. – Michael McGarrah Dec 13 '17 at 20:43
  • Would you not just import both relevant files into a single Python instance? So like (newlines as \r) `from abcfile import ABC\r from AnotherFile import OtherFunction \r list = ABC() \r OtherFunction(list)` ? – neophlegm Dec 13 '17 at 20:45
  • Some more context [here](https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial/Importing_Modules) – neophlegm Dec 13 '17 at 20:46

1 Answers1

0

https://www.learnpython.org/en/Functions has a very good section on how to use functions and the following sections on classes, objects and modules are worth reviewing.

Write a file: Python 2.7 : Write to file instantly

Passing args vs list: Advantages of using *args in python instead of passing a list as a parameter

That gives you a starting point for learning Python and solving your immediate problem.

Michael McGarrah
  • 585
  • 4
  • 10