晚安好,我有一個問題,即時試圖連接字符串到一個數組我有一個.txt中,在3個gruoups劃分「.I 1" ,」 2" .I 「.I 3」我的代碼生成一個「.I n」總數的數組,在這種情況下是一個3的數組,我的目標是將「.I x」之後的所有行存儲在數組的x位置例如....「.I 1" 陣列[1],」 .I 2" 在陣列[2]等級聯序列插入numpy的陣列中蟒
我的代碼只是保存的最後一行的下一個「.I」之前,而不是保存所有的線路,我知道這將發生,但問題是,我不知道如何連接或推或追加線到陣列的相同位置
txt文件cran.all.txt
.I 1
.T
experimental investigation of the aerodynamics of a
wing in a slipstream .
.A
brenckman,m.
.B
j. ae. scs. 25, 1958, 324.
.W
experimental investigation of the aerodynamics of a
wing in a slipstream .
an experimental study of a wing in a propeller slipstream was
made in order to determine the spanwise distribution of the lift
increase due to slipstream at different angles of attack of the wing
and at different free stream to slipstream velocity ratios . the
results were intended in part as an evaluation basis for different
theoretical treatments of this problem .
the comparative span loading curves, together with
supporting evidence, showed that a substantial part of the lift increment
produced by the slipstream was due to a /destalling/ or
boundary-layer-control effect . the integrated remaining lift
increment, after subtracting this destalling lift, was found to agree
well with a potential flow theory .
an empirical evaluation of the destalling effects was made for
the specific configuration of the experiment .
.I 2
.T
simple shear flow past a flat plate in an incompressible fluid of small
viscosity .
.A
ting-yili
.B
department of aeronautical engineering, rensselaer polytechnic
institute
troy, n.y.
.W
simple shear flow past a flat plate in an incompressible fluid of small
viscosity .
in the study of high-speed viscous flow past a two-dimensional body it
is usually necessary to consider a curved shock wave emitting from the
nose or leading edge of the body . consequently, there exists an
inviscid rotational flow region between the shock wave and the boundary
layer . such a situation arises, for instance, in the study of the
hypersonic viscous flow past a flat plate . the situation is somewhat
different from prandtl's classical boundary-layer problem . in prandtl's
original problem the inviscid free stream outside the boundary layer is
irrotational while in a hypersonic boundary-layer problem the inviscid
free stream must be considered as rotational . the possible effects of
vorticity have been recently discussed by ferri and libby . in the
present paper, the simple shear flow past a flat plate in a fluid of small
viscosity is investigated . it can be shown that this problem can again
be treated by the boundary-layer approximation, the only novel feature
being that the free stream has a constant vorticity . the discussion
here is restricted to two-dimensional incompressible steady flow .
.I 3
.T
the boundary layer in simple shear flow past a flat plate .
.A
m. b. glauert
.B
department of mathematics, university of manchester, manchester,
england
.W
the boundary layer in simple shear flow past a flat plate .
the boundary-layer equations are presented for steady
incompressible flow with no pressure gradient .
Python代碼
import re
import numpy as np
def total_archivos() :
hand = open("cran.all.txt")
total= 0
for line in hand:
line = line.strip()
if ".I" in line:
total=total+1
return total
def escribir() :
hand = open("cran.all.txt")
total= 0
for line in hand:
line = line.strip()
if ".I" in line:
total=total+1
else:
textos[total-1]=np.array(line)
cuenta=total_archivos()
textos = np.array(range(cuenta), dtype='|S1000')
escribir()
print cuenta
print textos[0]
print textos[1]
print textos[2]
結果
1400
the specific configuration of the experiment .
here is restricted to two-dimensional incompressible steady flow .
incompressible flow with no pressure gradient .
請注意,這只是從每個「一最後一行X」我要存儲在同一個陣列位置的所有行。在先進的感謝
很多關於你的幫助。
很多,但我有幾個問題,你會如何使用它?它正在返回布爾值,你對它的實現有任何想法嗎? – 2014-09-04 13:49:40