fgdocx  0.2 [master]
FlightGear API Docs
helpers.py
Go to the documentation of this file.
1 ## @package fgdocs
2 # Helper functions
3 
4 
5 ## Read a text file and return its contents
6 # @param path_to_file
7 # @retval str with file content
8 def read_file(path_to_file):
9  fob = open( path_to_file, "r")
10  file_content = fob.read()
11  fob.close()
12  return file_content
13 
14 ## Write text string to file path
15 # @param path_to_file
16 # @param contents string with contents to write
17 def write_file(path_to_file, contents):
18  fob = open( path_to_file, "w")
19  fob.write(contents)
20  fob.close()
21  return#
22 
23 def xsplit(v, char):
24  v = v.strip()
25  parts = v.split(char)
26  ret = []
27  for p in parts:
28  if p != "":
29  ret.append(p)
30  return ret
def read_file(path_to_file)
Read a text file and return its contents.
Definition: helpers.py:8
def xsplit(v, char)
Definition: helpers.py:23
def write_file(path_to_file, contents)
Write text string to file path.
Definition: helpers.py:17