• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

JoaoRodrigues

Index Error: list assignment index out of range

9 mensagens neste tópico

# Open Results_3 File

path = 'C:\\Documents and Settings\\joaorodrigues\\My Documents\\Joao\\Em Desenvolvimento\\results_3.txt'
open_file = open(path, 'r')
results = open_file.readlines()
open_file.close()
# Create Categories

title = []
author = []
journal = []
date = []

# Parse authors

for index in range(2,len(results)-1, 4):
    author[index] = results[index]        


# Create final output file

path = 'C:\\Documents and Settings\\joaorodrigues\\My Documents\\Joao\\Em Desenvolvimento\\results_4.txt'
open_file = open(path, 'w')
for index in range(1,len(results)):
    if index%2 == 0:
        open_file.write(str(results[index]))
        open_file.write('\n\n-----------------\n\n')
open_file.close()

Onde raio é que o erro (linha 12) está? É na lista author.. e não percebo o porquê muito sinceramente  :-[

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Ui...;)

1:

Zmijewski MA, Skorko-Glonek J, Tanfani F, Banecki B, Kotlarz A, Macario AJ.

The DnaK chaperones from the archaeon Methanosarcina mazei and the bacterium Escherichia coli have different substrate specificities.Acta Biochim Pol. 2007 Sep 19; [Epub ahead of print] PMID: 17882322 [PubMed - as supplied by publisher]

2:

Yanagisawa D, Kitamura Y, Inden M, Takata K, Taniguchi T, Morikawa S, Morita M, Inubushi T, Tooyama I, Taira T, Iguchi-Ariga SM, Akaike A, Ariga H.

DJ-1 protects against neurodegeneration caused by focal cerebral ischemia and reperfusion in rats.J Cereb Blood Flow Metab. 2007 Sep 19; [Epub ahead of print] PMID: 17882163 [PubMed - as supplied by publisher]

3:

Yamashita T, Oda T, Sekimoto T.

Hsp90 and the Fanconi Anemia Pathway: A Molecular Link Between Protein Quality Controland the DNA Damage Response.Cell Cycle. 2007 Jun 29;6(18) [Epub ahead of print] PMID: 17881891 [PubMed - as supplied by publisher]

4:

Tanaka S, Sawaya MR, Kerfeld CA, Yeates TO.

Structure of the RuBisCO chaperone RbcX from Synechocystis sp. PCC6803.Acta Crystallogr D Biol Crystallogr. 2007 Oct;63(Pt 10):1109-12. Epub 2007 Sep 19. PMID: 17881829 [PubMed - in process]

5:

Rainey-Barger EK, Magnuson B, Tsai B.

A chaperone-activated non-enveloped virus perforates the physiologically relevant ER membrane.J Virol. 2007 Sep 19; [Epub ahead of print] PMID: 17881435 [PubMed - as supplied by publisher]

6:

Hussain F, Wittung-Stafshede P.

Impact of cofactor on stability of bacterial (CopZ) and human (Atox1) copper chaperones.Biochim Biophys Acta. 2007 Aug 19; [Epub ahead of print] PMID: 17881304 [PubMed - as supplied by publisher]

7:

Jafarnejad A, Bathaie SZ, Nakhjavani M, Hassan MZ, Banasadegh S.

The improvement effect of L-Lys as a chemical chaperone on STZ-induced diabetic rats, protein structure and function.Diabetes Metab Res Rev. 2007 Sep 19; [Epub ahead of print] PMID: 17879961 [PubMed - as supplied by publisher]

8:

Galazka G, Jurewicz A, Orlowski W, Stasiolek M, Brosnan CF, Raine CS, Selmaj K.

, Links

EAE Tolerance Induction with Hsp70-Peptide Complexes Depends on H60 and NKG2D Activity.J Immunol. 2007 Oct 1;179(7):4503-12. PMID: 17878346 [PubMed - in process]

9:

Vila-Carriles WH, Zhou ZH, Bubien JK, Fuller CM, Benos DJ.

, Links

Participation of the chaperone Hsc70 in the trafficking and functional expression of ASIC2 in glioma cells.J Biol Chem. 2007 Sep 18; [Epub ahead of print] PMID: 17878160 [PubMed - as supplied by publisher]

10:

Edwards A, Li J, Atadja P, Bhalla K, Haura EB.

, Links

Effect of the histone deacetylase inhibitor LBH589 against epidermal growth factor receptor dependent human lung cancer cells.Mol Cancer Ther. 2007 Sep;6(9):2515-24. PMID: 17876048 [PubMed - in process]

11:

Stein R, Mattes MJ, Cardillo TM, Hansen HJ, Chang CH, Burton J, Govindan S, Goldenberg DM.

, Links

CD74: A New Candidate Target for the Immunotherapy of B-Cell Neoplasms.Clin Cancer Res. 2007 Sep 15;13(18):5556s-63s. PMID: 17875789 [PubMed - in process]

12:

Hageman J, Vos MJ, van Waarde MA, Kampinga HH.

, Links

Comparison of intra-organellar chaperone capacity for dealing with stress-induced protein unfolding.J Biol Chem. 2007 Sep 17; [Epub ahead of print] PMID: 17875648 [PubMed - as supplied by publisher]

13:

Beck DA, Bennion BJ, Alonso DO, Daggett V.

, Links

Simulations of macromolecules in protective and denaturing osmolytes: properties of mixed solvent systems and their effects on water and protein structure and dynamics.Methods Enzymol. 2007;428:373-96. PMID: 17875430 [PubMed - in process]

14:

Bisgaard CF, Jayatissa MN, Enghild JJ, Sanchez C, Artemychyn R, Wiborg O.

, Links

Proteomic Investigation of the Ventral Rat Hippocampus Links DRP-2 to Escitalopram Treatment Resistance and SNAP to Stress Resilience in the Chronic Mild Stress Model of Depression.J Mol Neurosci. 2007;32(2):132-44. PMID: 17873297 [PubMed - in process]

15:

Rocha ER, Tzianabos AO, Smith CJ.

, Links

Thioredoxin reductase is essential for the thiol/disulfide redox control and oxidative stress survival in the anaerobe Bacteroides fragilis.J Bacteriol. 2007 Sep 14; [Epub ahead of print] PMID: 17873045 [PubMed - as supplied by publisher]

16:

Xia T, Dimitropoulou C, Zeng J, Antonova GN, Snead C, Venema RC, Fulton DJ, Qian S, Patterson C, Papapetropoulos A, Catravas JD.

, Links

THE CHAPERONE-DEPENDENT E3 LIGASE, CHIP, UBIQUITINATES AND MEDIATES PROTEASOMAL DEGRADATION OF SOLUBLE GUANYLYL CYCLASE.Am J Physiol Heart Circ Physiol. 2007 Sep 14; [Epub ahead of print] PMID: 17873020 [PubMed - as supplied by publisher]

17:

Bazzaro M, Santillan A, Lin Z, Tang T, Lee MK, Bristow RE, Shih IM, Roden RB.

, Links

Myosin II Co-Chaperone General Cell UNC-45 Overexpression Is Associated with Ovarian Cancer, Rapid Proliferation, and Motility.Am J Pathol. 2007 Sep 14; [Epub ahead of print] PMID: 17872978 [PubMed - as supplied by publisher]

18:

Janig E, Haslbeck M, Aigelsreiter A, Braun N, Unterthor D, Wolf P, Khaskhely NM, Buchner J, Denk H, Zatloukal K.

, Links

Clusterin Associates with Altered Elastic Fibers in Human Photoaged Skin and Prevents Elastin from Ultraviolet-Induced Aggregation in Vitro.Am J Pathol. 2007 Sep 14; [Epub ahead of print] PMID: 17872975 [PubMed - as supplied by publisher]

19:

Park J, Kim M, Na G, Jeon I, Kwon YK, Kim JH, Youn H, Koo Y.

, Links

Glucocorticoids modulates NF-kappaB-dependent gene expression by up-regulating FKBP51 expression in Newcastle disease virus-infected chickens.Mol Cell Endocrinol. 2007 Aug 10; [Epub ahead of print] PMID: 17870233 [PubMed - as supplied by publisher]

20:

Amiri A, Noei F, Feroz T, Lee JM.

, Links

Geldanamycin Anisimycins Activate Rho and Stimulate Rho- and ROCK-Dependent Actin Stress Fiber Formation.Mol Cancer Res. 2007 Sep;5(9):933-42. PMID: 17855662 [PubMed - in process]

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Estás a criar um array vazio para armazenar dados:

author = []

E depois tentas usar o array:

author[index] = results[index]

Uma solução é usar o .append ou criar um array vazio com um determinado número de elementos neutros.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Já brinquei com o append. Vou então explorar mais essa via. Estranho..ia jurar que já tinha funcionado antes... Thanks ;)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Quando fazes for a um [], ele não devolve o index mas sim o valor.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Quando fazes for a um [], ele não devolve o index mas sim o valor.

Mas repara que ele está a usar um range() que devolve uma lista de inteiros.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Não, e eu quero mesmo de 4 em 4 números ;)

Vou ter que lidar com o append então. E quanto ao index, é só o nome da variável que o for itera para ser mais legível ;)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!


Registar nova conta

Entra

Já tem conta? Inicie sessão aqui.


Entrar Agora