MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Writing variables in strings (opened from text files)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86847] Writing variables in strings (opened from text files)
  • From: "sebastian.cohen at gmail.com" <sebastian.cohen at gmail.com>
  • Date: Sun, 23 Mar 2008 01:02:42 -0500 (EST)

Hello everyone,

Can someone please help me with the following issue? I am importing a
text file that I want to manipulate (replace some parts) and these
parts shall be variables. Please help. I tried putting more commas for
the variable but it didn't worked. I also tried with the ToString
command with no luck. Thanks for any help !!

Here is a sample of what I want to do:

game = Import["c:\textfile.txt", "Text"];

w = 1500;

game1 = StringReplace[gametheory, (" 3,") :> (" w,")];
game1 = StringReplace[gametheory1, (" 4,") :> (" w,")];
game1 = StringReplace[gametheory1, (" 5,") :> (" w,")];
game1 = StringReplace[gametheory1, (" 6,") :> (" w,")];

Export["c:\textfile.txt", game1, "Text"];

Thanks,

Sebastian Cohen


  • Prev by Date: Possible values for the Method option for Graphics??
  • Next by Date: Re: Viewpoint selector for Mac in 6.0?
  • Previous by thread: Re: Possible values for the Method option for Graphics??
  • Next by thread: Re: Writing variables in strings (opened from text files)