|
![](/i/fill.gif) |
Impressive ! Couldn't imagine it was soooooo easy. Thanks.
@Chrisir. Thanks for your kind proposition, but my problem is solved. And I
had to know how to do it, I'll have the same problem later, so...
42e5575c@news.povray.org...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> bancquart.sebastien wrote:
> | #declare leaves=union {
> | object {leave} matrix <....>
> | object {leave} matrix <....>
> | object {leave} matrix <....>
> | ... ... about 24000 lines like that
> | }
> |
> If you have one line per object and nothing else in the file
> (not even the "#decleare leaves=union {" and "}" lines, then the
> following python code should do what you want:
>
> ############################################################
> from random import shuffle
>
> f = open ("file.inc", "r")
> l = f.readlines()
> f.close()
> shuffle (l)
> f = open ("one.inc", "w")
> f.writelines (l[:len(l)/3])
> f.close()
> f = open ("two.inc", "w")
> f.writelines (l[len(l)/3:(2*len(l))/3])
> f.close()
> f = open ("three.inc", "w")
> f.writelines (l[(2*len(l))/3:])
> f.close()
> ############################################################
>
> Note that if you have kept the first and last lines in the input
> file, you can get rid of them by replacing line 4 by:
> "l = f.readlines()[1:-1]"
>
> Jerome
> - --
> ******************************
> * Jerome M. Berger *
> * mailto:jeb### [at] free fr *
> * http://jeberger.free.fr/ *
> ******************************
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.0 (GNU/Linux)
>
> iD8DBQFC5VdbqIYJdJhyixIRAmkXAJ4la65rHfh0j5LWGQOE6HxZG28y3wCfVZIU
> DuAnJWsIWX1PBg6GQwJQ3AU=
> =SEn/
> -----END PGP SIGNATURE-----
Post a reply to this message
|
![](/i/fill.gif) |