Hey guys, literally just starting off on python, just making a simple menu based system to read/write files and delete a file to get used to calling functions and working with the file system etc.
For some reason the code won't write to the file I have on my system, not sure what I'm doing wrong.
All help or constructive criticism about how I'm going about this would be much appreciated.
Code:
import os
def writer_func():
file_targ=raw_input("Enter file path and name: ")
texty=raw_input("Enter text: ")
file_targ=str('file_targ')
fob=open('file_targ','w')
fob.write('texty')
fob.close()
print '%s' % texty
print " Main Menu"
print "1) Write a file"
print "2) Read a file"
print "3) Delete a file"
main_menu=raw_input('Enter options [1-3] : ')
main_menu=int(main_menu)
if main_menu == 1:
print ("You chose to write a file")
writer_func()
elif main_menu == 2:
print ("You chose to read a file")
reader_func()
elif main_menu == 3:
print ("You chose to delete a file")
deleter
else:
print ("Invalid choice")
exit
Problem:
I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Hello I am a noob in XML and Python. I am trying to do this for my MSc project about a network simulation and need some help.... I want to change the values shown below:
<num_crash_failures>1</num_crash_failures>
−<crash_failure_entry>
<freeze_at_slot>0</freeze_at_slot>... (0 Replies)
Hi!
I have created on script which is working fine with menu options and with a sub-menu.
I want to enhance it by using sub-options under menu options.
Like.
option 1) will give the list only.
option 1.1) should give the option to user to choose one file, whose content user wanna see. ... (3 Replies)
hi all i am a newbie to this
is there any examples on creating a main menu with 3 sub menu
main menu -> option a , b and c
a menu -> option 1 ,2 and 3
b menu -> option 1 ,2
c menu -> option 1 ,2
i am getting headache as my code kept getting unexpected EOF
---------- Post... (0 Replies)
I am working on requirement on spreadsheet in python scripting.
I have a spreadsheet containing cell values and with background color.
I am able to read the value value but unable to get the background color of that particular cell.
Actually my requirement is to read the cell value along... (1 Reply)
Hi all,
I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine..
Below is the code I am trying:
#!/usr/bin/env python
import wmi
c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Hi all...
As you know I like making code backwards compatible for as many platforms as possible.
This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome.
Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies
LEARN ABOUT NETBSD
menu_post
MENU_POST(3) BSD Library Functions Manual MENU_POST(3)NAME
post_menu, unpost_menu -- post (draw) or unpost a menu
LIBRARY
Curses Menu Library (libmenu, -lmenu)
SYNOPSIS
#include <menu.h>
int
post_menu(MENU *menu);
int
unpost_menu(MENU *menu);
DESCRIPTION
The post_menu() function causes the menu to be drawn on the screen. Any functions defined by either set_menu_init() or set_item_init() (see
menu_hook(3)) are called before the menu is placed on the screen. The unpost_menu() does the opposite, it removes a menu from the screen.
Any functions defined by both set_menu_term() and set_item_term() (see menu_hook(3)) are called prior to the menu's removal.
RETURN VALUES
The functions return one of the following error values:
E_OK The function was successful.
E_SYSTEM_ERROR There was a system error during the call.
E_BAD_ARGUMENT One or more of the arguments passed to the function was incorrect.
E_POSTED The menu is already posted.
E_BAD_STATE The function was called from within an initialization or termination routine.
E_NO_ROOM The menu does not fit within the subwindow.
E_NOT_CONNECTED The item is not connected to a menu.
SEE ALSO curses(3), menu_hook(3), menus(3)NOTES
The header <menu.h> automatically includes both <curses.h> and <eti.h>.
BSD September 10, 1999 BSD